//
//  LSZRulesTableViewCell.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/6/7.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZRulesTableViewCell.h"

@implementation LSZRulesTableViewCell
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {

        UILabel * label = [[UILabel alloc]init];
        label.tintColor = titleColorLSZ;
        label.text = @"福音值抵现";
        [self addSubview:label];

        self.butRules  = [[UIButton alloc]init];
        [self.butRules setImage:[UIImage imageNamed:@"问号"] forState:UIControlStateNormal];
        [self addSubview:self.butRules];
        
        self.labelMovew = [[UILabel alloc]init];
        self.labelMovew.textColor = navColor;
        self.labelMovew.textAlignment = NSTextAlignmentRight;
        self.labelMovew.text = @"更多商品抵现>";
        [self addSubview:self.labelMovew];

        if (ScreenWidth == 320) {
            //5
            label.font = FONT_(13.5);
            self.labelMovew.font  = FONT_(13.5);
            CGFloat widthLabelTitle = [LSZSpecialPackaging getsTheAdaptiveWidth:label sizeMaxWidth:ScreenWidth/2];
            label.frame = CGRectMake(10, 10,widthLabelTitle, 16);
            self.butRules.frame = CGRectMake(CGRectGetMaxX(label.frame)+2, 10, 16, 16);
            self.labelMovew.frame = CGRectMake(ScreenWidth/2, 10, ScreenWidth/2-10, 16);
        }else if(ScreenWidth == 375){
            // 6 7
            label.font = FONT_(14);
            self.labelMovew.font  = FONT_(14);
            CGFloat widthLabelTitle = [LSZSpecialPackaging getsTheAdaptiveWidth:label sizeMaxWidth:ScreenWidth/2];
            label.frame = CGRectMake(10, 10,widthLabelTitle, 18);
            self.butRules.frame = CGRectMake(CGRectGetMaxX(label.frame)+2, 10, 18, 18);
            self.labelMovew.frame = CGRectMake(ScreenWidth/2, 10, ScreenWidth/2-10, 18);
        }else {
            //plus
            label.font = FONT_(14.5);
            self.labelMovew.font  = FONT_(14.5);
            CGFloat widthLabelTitle = [LSZSpecialPackaging getsTheAdaptiveWidth:label sizeMaxWidth:ScreenWidth/2];
            label.frame = CGRectMake(10, 10,widthLabelTitle, 20);
            self.butRules.frame = CGRectMake(CGRectGetMaxX(label.frame)+2, 11, 19, 19);
            self.labelMovew.frame = CGRectMake(ScreenWidth/2, 10, ScreenWidth/2-10, 20);
        }

        UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
        CGFloat width = (ScreenWidth - 40 -1) / 3;
        flowLayout.itemSize = CGSizeMake(width, width);
        flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;//水平滚动
        flowLayout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
        flowLayout.minimumLineSpacing = 10;//间距

       LSZGoodsVC *myCollectionView = [[LSZGoodsVC alloc]initWithFrame:CGRectMake(0,CGRectGetMaxY(label.frame),ScreenWidth, width+20) collectionViewLayout:flowLayout];
        self.myCollectionView = myCollectionView;
        myCollectionView.scrollsToTop = NO;
        myCollectionView.showsVerticalScrollIndicator = NO;
        myCollectionView.showsHorizontalScrollIndicator = NO;
        [self.contentView addSubview:myCollectionView];


        /*
        UIImageView * imageViewRules = [[UIImageView alloc]init];
        imageViewRules.image = [UIImage imageNamed:@"每日签到_规则"];
        [self addSubview:imageViewRules];

        UILabel * labelRules = [[UILabel alloc]init];
        labelRules.textColor = titleColorLSZ;
        labelRules.text = @"签到规则";
        [self addSubview:labelRules];

        UIView * viewLine = [[UIView alloc]init];
        viewLine.backgroundColor = divider;
        [self addSubview:viewLine];

        UILabel * labelRulesInterpretation = [[UILabel alloc]init];
        labelRulesInterpretation.textColor = lightColor;
//        labelRulesInterpretation.backgroundColor = [UIColor yellowColor];
        labelRulesInterpretation.numberOfLines = 0;
        labelRulesInterpretation.text = @"签到时间:每周一至周日 \n每日可签到时间:00:00至10:00 \n签到规则:\n1,每天早上10点前进行早祷告; \n2,每天只能签到一次.";
        [self addSubview:labelRulesInterpretation];

        if (ScreenWidth == 320) {
            //5
            labelRules.font = FONT_(14.5);
            labelRulesInterpretation.font = FONT_(13.5);

            imageViewRules.frame = CGRectMake(15,13,14,16);
            labelRules.frame = CGRectMake(CGRectGetMaxX(imageViewRules.frame)+15,13,ScreenWidth- CGRectGetMaxX(imageViewRules.frame)-15,16);
            viewLine.frame = CGRectMake(20, CGRectGetMaxY(imageViewRules.frame)+13,ScreenWidth-20, 0.5);
            labelRulesInterpretation.frame = CGRectMake(15,  CGRectGetMaxY(viewLine.frame)+6,  ScreenWidth,165- CGRectGetMaxY(viewLine.frame)-24);

        }else if(ScreenWidth == 375){
            // 6 7
            labelRules.font = FONT_(15);
            labelRulesInterpretation.font = FONT_(14);

            imageViewRules.frame = CGRectMake(15,15,16,18);
            labelRules.frame = CGRectMake(CGRectGetMaxX(imageViewRules.frame)+15,15,ScreenWidth- CGRectGetMaxX(imageViewRules.frame)-15,18);
            viewLine.frame = CGRectMake(20, CGRectGetMaxY(imageViewRules.frame)+15,ScreenWidth-20, 0.5);
            labelRulesInterpretation.frame = CGRectMake(15,  CGRectGetMaxY(viewLine.frame)+10,  ScreenWidth,155- CGRectGetMaxY(viewLine.frame)-20);
        }else {
            //plus
            labelRules.font = FONT_(15.5);
            labelRulesInterpretation.font = FONT_(14.5);

            imageViewRules.frame = CGRectMake(15,17,18,20);
            labelRules.frame = CGRectMake(CGRectGetMaxX(imageViewRules.frame)+15,17,ScreenWidth- CGRectGetMaxX(imageViewRules.frame)-15,20);
            viewLine.frame = CGRectMake(20, CGRectGetMaxY(imageViewRules.frame)+17,ScreenWidth-20, 0.5);
            labelRulesInterpretation.frame = CGRectMake(15,  CGRectGetMaxY(viewLine.frame)+14,  ScreenWidth,173- CGRectGetMaxY(viewLine.frame)-28);

        }
        */

    }
    return self;
}
@end
